package com.kyk.controller;

import com.kyk.service.IRestaurantsService;
import com.kyk.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 餐厅表 前端控制器
 * </p>
 *
 * @author 凯
 * @since 2025-09-12
 */
@RestController
@RequestMapping("/restaurants")
public class RestaurantsController {

    @Autowired
    IRestaurantsService restaurantsService;

    @GetMapping
    public Result getRestaurants(
            // 从请求头获取过滤器传递的用户ID和类型
            @RequestHeader("X-User-Id") Long merchantId,
            @RequestHeader("X-User-Type") String userType) {

        System.out.println(merchantId);
        System.out.println(userType);

        return restaurantsService.getRestaurants(merchantId, userType);
    }


}
